package background;

import java.util.ArrayList;

import database.FTodoEntities;
import entity.DummyFTodoExpandable;
import entity.FTodo;
import android.os.AsyncTask;

public class FTodoExpandableAsyn extends AsyncTask<DummyFTodoExpandable, Integer, DummyFTodoExpandable> {

	@Override
	protected DummyFTodoExpandable doInBackground(DummyFTodoExpandable... params) {
		DummyFTodoExpandable dummyFTodoExpandable = params[0];
		ArrayList<Integer> groupsDate = FTodoEntities.
								getInstance(dummyFTodoExpandable.context).
								getListDate(dummyFTodoExpandable.dateFrom, dummyFTodoExpandable.dateTo);
		ArrayList<ArrayList<FTodo>> ftodos = FTodoEntities.
								getInstance(dummyFTodoExpandable.context).
								getListFTodoDate(groupsDate);
		dummyFTodoExpandable.dates = groupsDate;
		dummyFTodoExpandable.fTodos = ftodos;
		return dummyFTodoExpandable;
	}

	@Override
	protected void onPostExecute(DummyFTodoExpandable result) {
		result.callback.onFinish(result.dates, result.fTodos, false);
	}
}
